/**
*  Author: Magnus Hemmer Pihl
*  Student number: 5452
*
*  Assignment 2
*  16/9-2007
**/

#include <cstdlib>
#include <iostream>

using namespace std;

typedef unsigned int varType;

//Creates a list containing a dynamic number of elements.
//The list performs automatic resizing and rearranging.
//See List.cpp for per-method descriptions.
class List
{
private:
    int size;			//Actual size (number of positions) in the array
    varType *arr;		//The array containing data
    int length;			//Number of initialized elements in the array

    void expand();
    void rearrange();
    void shiftArray(int pos);

public:
    List();
    ~List();
    void insert(varType val, int pos);
    void erase(int pos);
    void push(varType val);
    varType pop();
    int getSize();
    void clear();
    bool empty();
    varType & at(int pos);
    varType & operator[](int pos);
    const varType & operator[](int pos) const;
    List &operator+(const List &data);
    List &operator+=(const List &data);
    bool operator==(const List &data);
    bool operator!=(const List &data);
    friend ostream &operator<<(ostream &os, const List &data);
};